package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.po.BiOrderDay;
import com.ygqh.baby.po.BiOrderDayExample;
import com.ygqh.baby.po.YgOrder;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface BiOrderDayMapper {
    int countByExample(BiOrderDayExample example);

    int deleteByExample(BiOrderDayExample example);

    int deleteByPrimaryKey(Long id);

    int insert(BiOrderDay record);

    int insertSelective(BiOrderDay record);

    List<BiOrderDay> selectByExample(BiOrderDayExample example);

    BiOrderDay selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") BiOrderDay record, @Param("example") BiOrderDayExample example);

    int updateByExample(@Param("record") BiOrderDay record, @Param("example") BiOrderDayExample example);

    int updateByPrimaryKeySelective(BiOrderDay record);

    int updateByPrimaryKey(BiOrderDay record);

    int countSuper(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("shopNo") String shopNo, @Param("shopName") String shopName,
                   @Param("warehouseNo") String warehouseNo);

    List<BiOrderDay> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("startDate") Date startDate,
                                 @Param("endDate") Date endDate, @Param("shopNo") String shopNo, @Param("shopName") String shopName,
                                 @Param("warehouseNo") String warehouseNo);

    List<YgOrder> selectOrderByDay(@Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                   @Param("sourceCodes") String[] sourceCodes);

    int addBiOrderDayBatch(@Param("orderDayList") List<BiOrderDay> orderDayList);

    /**
     * 统计每日订单毛利
     *
     * @param startDate
     * @param endDate
     * @return
     */
    BiOrderDay executeOrderDateGrossProfit(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<BiOrderDay> executeOrderStatistics(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<BiOrderDay> executeOrderStatisticsBySupplier(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<BiOrderDay> executeOrderDateGrossProfitBySupplier(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<BiOrderDay> executeOrderStatisticsV2(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<BiOrderDay> executeOrderDateGrossProfitV2(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    BiOrderDay selectByShop(@Param("shopNo") String shopNo, @Param("date") Date date, @Param("warehouseNo") String warehouseNo);

    int additionBatch(@Param("list") List<BiOrderDay> list);

    List<BiOrderDay> selectList(@Param("queryInfo") QueryInfo queryInfo, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                @Param("excludeShopNo") String[] excludeShopNo, @Param("warehouseNo") String warehouseNo);

    BigDecimal getTotalOrderPrice(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("excludeShopNo") String[] excludeShopNo
            , @Param("warehouseNo") String warehouseNo);

    BigDecimal getTotalPayPriceByShop(@Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                      @Param("shopNo") String shopNo, @Param("shopName") String shopName, @Param("warehouseNo") String warehouseNo);


    List<YgOrder> selectOrderListAfterId(@Param("startId") Long startId);

    List<BiOrderDay> executeOrderStatisticsNew(@Param("start") Date start, @Param("end") Date end, @Param("shopNo") String[] shopNo);

    List<BiOrderDay> executeOrderDateGrossProfitNew(@Param("start") Date start, @Param("end") Date end, @Param("shopNo") String[] shopNo);

    Long selectOrderMaxId();

    List<BiOrderDay> executeOrderStatisticsByDetail(@Param("start") Date start, @Param("end") Date end, @Param("shopNo") String[] shopNo);

    int updateBatch(@Param("dataList") List<BiOrderDay> dataList);
}
